package newcommerce.lastfm.api.data 
{
	import newcommerce.lastfm.api.feeds.LFMImageFeed;
	/**
	 * ...
	 * @author Martin Legris ( http://blog.martinlegris.com )
	 */
	public class LFMArtistImageData
	{
		protected var _title:String = "";
		protected var _url:String = "";
		protected var _dateAdded:String = "";
		protected var _format:String = "";
		protected var _ownerName:String;
		protected var _ownerUrl:String;
		protected var _images:LFMImageFeed;
		protected var _votesUp:Number;
		protected var _votesDown:Number;
		
		public function get votesDown():Number { return _votesDown; }
		public function get votesUp():Number { return _votesUp; }
		public function get images():LFMImageFeed { return _images; }
		public function get ownerUrl():String { return _ownerUrl; }
		public function get ownerName():String { return _ownerName; }
		public function get format():String { return _format; }
		public function get dateAdded():String { return _dateAdded; }
		public function get url():String { return _url; }
		public function get title():String { return _title; }
		
		public static function fromXML(xml:XML):LFMArtistImageData
		{
			var data:LFMArtistImageData = new LFMArtistImageData();
			
			data._title = xml.title[0].toString();
			data._url = xml.url[0].toString()
			data._dateAdded = xml.dateadded[0].toString();
			data._format = xml.format[0].toString();
			data._ownerName = xml.owner[0].name[0].toString();
			data._ownerUrl = xml.owner[0].url[0].toString();
			data._images = new LFMImageFeed(xml.sizes[0].size);
			data._votesUp = parseInt(xml.votes[0].thumbsup[0].toString());
			data._votesDown = parseInt(xml.votes[0].thumbsdown[0].toString());
			
			return data;
		}
	}	
}